{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e8f64a4c",
   "metadata": {},
   "source": [
    "* 2023-10-09\n",
    "* 课程： Python语言\n",
    "* week05"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d1d52b90",
   "metadata": {},
   "source": [
    "# 1.用户输入\n",
    "> 1. input()\n",
    "> 2. input输出的数据类型是：String（字符串）\n",
    " \n",
    " "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "45af43d4",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a5114942",
   "metadata": {},
   "outputs": [],
   "source": [
    "input(\"name:\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "b57a164b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入用户名:liaoziru\n",
      "请输入密码:123456\n"
     ]
    }
   ],
   "source": [
    "# 用户注册\n",
    "username = input(\"请输入用户名:\")\n",
    "password = input(\"请输入密码:\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "898014a1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "liaoziru\n"
     ]
    }
   ],
   "source": [
    "print(username)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "37f349ea",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "123456\n"
     ]
    }
   ],
   "source": [
    "print(password)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bdfebc25",
   "metadata": {},
   "source": [
    "* 秒记: 两个==是等于的意思"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "ad0da74a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "欢迎尊贵的VVVIP登录！！！\n"
     ]
    }
   ],
   "source": [
    "# 用户登录\n",
    "if username ==\"liaoziru\" and password ==\"123456\":\n",
    "    print(\"欢迎尊贵的VVVIP登录！！！\")\n",
    "else:\n",
    "    print(\"账号或密码不正确，请重新尝试！！！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "d61665c3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入用户名:liaoziru\n",
      "请输入密码:1234567\n",
      "账号或密码不正确，请重新尝试！！！\n"
     ]
    }
   ],
   "source": [
    "# 用户注册\n",
    "username = input(\"请输入用户名:\")\n",
    "password = input(\"请输入密码:\")\n",
    "# 用户登录\n",
    "if username ==\"liaoziru\" and password ==\"123456\":\n",
    "    print(\"欢迎尊贵的VVVIP登录！！！\")\n",
    "else:\n",
    "    print(\"账号或密码不正确，请重新尝试！！！\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "665dcfca",
   "metadata": {},
   "source": [
    "# 用户规范化/格式化输出\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "20711be6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入你的姓名:廖紫茹\n",
      "输入你的年龄:18\n"
     ]
    }
   ],
   "source": [
    "# 输入的内容\n",
    "name = input(\"输入你的姓名:\")\n",
    "age = input(\"输入你的年龄:\")\n",
    "job = input(\"输入你的职业:\")\n",
    "salary = input(\"输入你的薪资:\")\n",
    "\n",
    "#info为展示的数据\n",
    "info = \"\"\"---------淘宝-------\n",
    "姓名是: %s\n",
    "年龄是: %s\n",
    "工作是: %s\n",
    "薪资为: %s\"\"\"%(name,age,job,salary)\n",
    "\n",
    "# 打印结果\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bf3759e1",
   "metadata": {},
   "source": [
    "* 占位符"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b3507a07",
   "metadata": {},
   "source": [
    "> 1. 顺序\n",
    "> 2.  %s代表字符串  \n",
    "    %d代表数字（整数）  \n",
    "    %f代表小数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "8541f792",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入你的名字:liaoziru\n",
      "输入你的年龄:18\n",
      "输入你的职业:学生\n",
      "输入你的薪资:1500\n",
      "--------INFO liaoziru------\n",
      "姓名是: liaoziru\n",
      "年龄是: 18\n",
      "工作是: 学生\n",
      "薪资为: 1500\n"
     ]
    }
   ],
   "source": [
    "# 输入的内容（后端）\n",
    "name = input(\"输入你的名字:\")\n",
    "age = input(\"输入你的年龄:\")\n",
    "job = input(\"输入你的职业:\")\n",
    "salary = input(\"输入你的薪资:\")\n",
    "\n",
    "#info为展示的数据（前端）\n",
    "info = \"\"\"--------INFO {N}------\n",
    "姓名是: {N}\n",
    "年龄是: {A}\n",
    "工作是: {J}\n",
    "薪资为: {S}\"\"\".format(N=name,J=job,S=salary,A=age)\n",
    "\n",
    "# 打印结果\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "82e2fcd5",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
